//
//  ViewController.m
//  推送
//
//  Created by song on 15/8/16.
//  Copyright (c) 2015年 song. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)startshedule:(id)sender {
    
    UILocalNotification*notification = [[UILocalNotification alloc]init];
    NSDate * pushDate = [NSDate dateWithTimeIntervalSinceNow:1];
    if (notification != nil) {
        notification.fireDate = pushDate;
        notification.timeZone = [NSTimeZone defaultTimeZone];
        notification.repeatInterval = kCFCalendarUnitMinute;
        notification.soundName = UILocalNotificationDefaultSoundName;
        notification.alertBody = @"hello，world";
        notification.applicationIconBadgeNumber = 0;
        NSDictionary*info = [NSDictionary dictionaryWithObject:@"test" forKey:@"name"];
        notification.userInfo = info;
        [[UIApplication sharedApplication] scheduleLocalNotification:notification];
        
    }
}

- (IBAction)stopshedule:(id)sender {
    
    [[UIApplication sharedApplication] cancelAllLocalNotifications ];
}
@end
